package com.itheima.d14_extends_constructor;

public class Cat {
    private String name;
    private String color;
    private int age;

    public Cat() {
        //使用无参构造方法创建对象时，让name默认是"小花"，color默认是"白色"，age默认是"2岁"
//        name = "小花";
//        color = "白色";
//        age = 2;

        //或：
        this("小花","白色",2);
        //super不能和this调用构造方法同存
//        super(); //报错：Call to 'super()' must be first statement in constructor body
    }

    public Cat(String name, String color, int age) {
        this.name = name;
        this.color = color;
        this.age = age;
    }
}
